//
//  HomeCollectionViewCell.m
//  SHOP
//
//  Created by L on 2017/10/12.
//  Copyright © 2017年 L. All rights reserved.
//

#import "HomeCollectionViewCell.h"

@interface HomeCollectionViewCell ()

@property (nonatomic, weak)UIImageView *iconView;

@property (nonatomic, weak)UILabel *labelName;

@end

@implementation HomeCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    UIImageView *image = [[UIImageView alloc] init];
    image.image = [UIImage imageNamed:@"icon01"];
    [self.contentView addSubview:image];
    [image mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.offset(15);
    }];
    
    UILabel *label = [UILabel makeWithText:@"秒杀" andTextColor:[UIColor blackColor] andTextFont:17];
    [self.contentView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.bottom.offset(-15);
    }];
    
    _iconView = image;
    _labelName = label;
}

- (void)setModel:(HomeCollectionVieModel *)model
{
    _model = model;
    
    _iconView.image = [UIImage imageNamed:model.image];
    _labelName.text = model.title;
}

@end
